package com.ict.web.controller.yzq;

import com.ict.common.annotation.Log;
import com.ict.common.core.controller.BaseController;
import com.ict.common.core.domain.AjaxResult;
import com.ict.common.core.page.TableDataInfo;
import com.ict.common.enums.BusinessType;
import com.ict.web.domain.PerformanceRule;
import com.ict.web.dto.InsertPerformanceRuleDto;
import com.ict.web.service.IPerformanceRuleService;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;

import java.util.List;

/**
 * 指标规则Controller
 *
 * @author xss
 * @date 2022-02-15
 */
@Api(tags = "指标规则")
@RestController
@RequestMapping("/web/performanceRule")
public class PerformanceRuleController extends BaseController {
    @Autowired
    private IPerformanceRuleService performanceRuleService;

    /**
     * 查询指标规则
     */
    @ApiOperation("查询指标规则")
    @GetMapping("/list")
    public TableDataInfo list() {
        startPage();
        List<PerformanceRule> list = performanceRuleService.selectPerformanceRuleList();
        return getDataTable(list);
    }
/*    *//**
     * 新增指标规则
     *//*
    @ApiOperation("新增指标规则")
    @Log(title = "指标规则", businessType = BusinessType.INSERT)
    @PostMapping("/addSave")
    public AjaxResult add(Long indicatorsId,@RequestBody List<InsertPerformanceRuleDto> addDtoS) {
        performanceRuleService.insertPerformanceRule(indicatorsId,addDtoS);
        return AjaxResult.success();
    }*/
    /**
     * 删除指标规则
     */
    @ApiOperation("删除指标规则信息")
    @Log(title = "指标规则", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ruleId}")
    public AjaxResult remove(@PathVariable Long ruleId) {
        return toAjax(performanceRuleService.deletePerformanceRuleById(ruleId));
    }
}
